package org.micode.common.file;

public enum UploadFileTypeEnum {
    /**
     * 0, "图片"
     */
    IMAGE(0, "image"),

    /**
     * 1, "语音"
     */
    VOICE(1, "voice"),

    /**
     * 2, "视频"
     */
    VIDEO(2, "video"),

    /**
     * 9, "其他文件"
     */
    OTHER(9, "other"),
    ;

    private int code;

    private String name;

    UploadFileTypeEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public static UploadFileTypeEnum getByCode(int code) {
        for (UploadFileTypeEnum status : UploadFileTypeEnum.values()) {
            if (status.code == code) {
                return status;
            }
        }
        return OTHER;
    }

    public String getName() {
        return name;
    }

    public int getCode() {
        return code;
    }

}
